Skip to content

✨ [Frontend] Check if I can write_functions #7888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 16, 2025

Conversation

odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Jun 12, 2025

What do these changes do?

In order to show the Create Functions section, the user needs to belong to a group that is allowed to write_functions.

EnableWriteFunctions

Related issue/s

How to test

Dev-ops

@odeimaiz odeimaiz self-assigned this Jun 12, 2025
@odeimaiz odeimaiz added t:enhancement Improvement or request on an existing feature a:frontend issue affecting the front-end (area group) release Preparation for pre-release/release labels Jun 12, 2025
@odeimaiz odeimaiz added this to the Engage milestone Jun 12, 2025
@odeimaiz odeimaiz changed the title ✨ [Frontend] Check if my group can do Functions ✨ [Frontend] Check if my group can write_functions Jun 12, 2025
@odeimaiz odeimaiz requested a review from Copilot June 12, 2025 15:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that the “Create Functions” section is only shown when the user’s group has the write_functions permission by:

  • Adding a new functionPermissions endpoint and loading both general and function-specific permissions at startup
  • Refactoring Permissions to store and expose group-level and function-level permissions via checkMyGroupCanDo and checkFunctionPermissions
  • Updating UI components (NodeOptions, ResourceDetails) to use the new permission checks and automatically rebuild layouts

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
services/static-webserver/client/source/class/osparc/widget/NodeOptions.js Renamed buildLayout to private __buildLayout and applied it on node property; switched permission check to checkMyGroupCanDo
services/static-webserver/client/source/class/osparc/desktop/WorkbenchView.js Removed manual buildLayout call now handled by the property apply
services/static-webserver/client/source/class/osparc/desktop/MainPage.js Preload both general and function permissions before rendering
services/static-webserver/client/source/class/osparc/data/Resources.js Added functionPermissions resource definition
services/static-webserver/client/source/class/osparc/data/Permissions.js Introduced __permissions and __functionPermissions, methods to fetch and check them
services/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.js Changed plugin-disabled check to use checkFunctionPermissions
Comments suppressed due to low confidence (3)

services/static-webserver/client/source/class/osparc/data/Permissions.js:300

  • [nitpick] Consider adding a JSDoc comment to explain the purpose of fetchFunctionPermissions and its relationship with __functionPermissions.
fetchFunctionPermissions: function() {

services/static-webserver/client/source/class/osparc/desktop/MainPage.js:73

  • New startup permission-fetching logic should be covered by tests to ensure both general and function permissions are loaded before the UI displays.
preloadPromises.push(osparc.data.Permissions.getInstance().fetchPermissions());

services/static-webserver/client/source/class/osparc/data/Permissions.js:317

  • The variable functionPermissions is undefined here; it should reference this.__functionPermissions[action].
return functionPermissions[action];

@odeimaiz odeimaiz marked this pull request as ready for review June 16, 2025 09:57
Copy link

@odeimaiz odeimaiz added the 🤖-automerge marks PR as ready to be merged for Mergify label Jun 16, 2025
@odeimaiz
Copy link
Member Author

@mergify queue

Copy link
Contributor

mergify bot commented Jun 16, 2025

queue

🟠 Waiting for conditions to match

  • -closed [📌 queue requirement]
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of: [📌 queue -> configuration change requirements]
    • -mergify-configuration-changed
    • check-success = Configuration changed
  • any of: [🔀 queue conditions]
    • all of: [📌 queue conditions of queue default]
      • #approved-reviews-by >= 2 [🛡 GitHub branch protection]
      • #approved-reviews-by>=2
      • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
      • #changes-requested-reviews-by=0
      • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
      • #review-threads-unresolved=0
      • -conflict
      • -draft
      • base=master
      • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
      • label!=🤖-do-not-merge
      • label=🤖-automerge
      • any of: [🛡 GitHub branch protection]
        • check-skipped = deploy to dockerhub
        • check-neutral = deploy to dockerhub
        • check-success = deploy to dockerhub
      • any of: [🛡 GitHub branch protection]
        • check-success = system-tests
        • check-neutral = system-tests
        • check-skipped = system-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = unit-tests
        • check-neutral = unit-tests
        • check-skipped = unit-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = check OAS' are up to date
        • check-neutral = check OAS' are up to date
        • check-skipped = check OAS' are up to date
      • any of: [🛡 GitHub branch protection]
        • check-success = integration-tests
        • check-neutral = integration-tests
        • check-skipped = integration-tests
      • any of: [🛡 GitHub branch protection]
        • check-success = build-test-images (frontend) / build-test-images
        • check-neutral = build-test-images (frontend) / build-test-images
        • check-skipped = build-test-images (frontend) / build-test-images

@odeimaiz odeimaiz changed the title ✨ [Frontend] Check if my group can write_functions ✨ [Frontend] Check if I can write_functions Jun 16, 2025
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@odeimaiz odeimaiz merged commit 30327ed into ITISFoundation:master Jun 16, 2025
58 checks passed
@odeimaiz odeimaiz deleted the feature/can-i-function branch June 16, 2025 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖-automerge marks PR as ready to be merged for Mergify a:frontend issue affecting the front-end (area group) release Preparation for pre-release/release t:enhancement Improvement or request on an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants